import 'package:flutter/material.dart';
import 'package:wanchong/widget/app_bar.dart';
import 'package:city_picker/city_picker.dart';

class ModifyLoc extends StatefulWidget {
  @override
  _UserInfoState createState() => _UserInfoState();
}

class _UserInfoState extends State<ModifyLoc> {
  @override
  var userName = '吾皇晚睡'; //用户姓名
  var userPhone = '18320515101';
  var userLocS = "召唤师峡谷 德玛西亚 哈哈";
  var userLoc = '保定县 德玛西亚乡 洛克沙山村村 7组5号 ';
  var swachSt = false;
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomPadding: false,
      appBar: MyAppBar(
          child: Align(
        child: Container(
          padding: EdgeInsets.only(left: 10.0, right: 10.0),
          child: Stack(
            children: <Widget>[
              GestureDetector(
                onTap: () {
                  Navigator.pop(context);
                },
                child: new Align(
                  alignment: FractionalOffset.centerLeft,
                  child: Container(
                    padding: EdgeInsets.only(right: 15.0),
                    color: Colors.transparent,
                    height: double.infinity,
                    child: Image.asset("assets/login/top_return_icon.png"),
                  ),
                ),
              ),
              new Align(
                alignment: FractionalOffset.center,
                child: new Text(
                  '修改地址',
                  style: new TextStyle(
                    color: Color(0xFF3C4450),
                    fontSize: 15.0,
                    fontWeight: FontWeight.w700,
                  ),
                ),
              ),
              new Align(
                alignment: FractionalOffset.centerRight,
                child: new Text(
                  '确认',
                  style: new TextStyle(
                    color: Color(0xFF3C4450),
                    fontSize: 15.0,
                  ),
                ),
              ),
            ],
          ),
        ),
      )),
      body: Container(
          child: new Column(
        children: <Widget>[
          //用户姓名
          Container(
            height: 60,
            margin: EdgeInsets.only(top: 15.0),
            color: Color(0xFFFFFFFF),
            child: Column(
              children: <Widget>[
                Container(
                  padding: EdgeInsets.only(left: 15.0, right: 15.0),
                  height: 59,
                  child: Stack(
                    children: <Widget>[
                      new Align(
                        alignment: FractionalOffset.centerLeft,
                        child: Container(
                            width: 150,
                            child: TextField(
                              style: TextStyle(
                                  color: Color(0xFF3C4450), fontSize: 14.0),
                              decoration: InputDecoration(
                                  border: InputBorder.none,
                                  hintText: userName,
                                  hintStyle: TextStyle(
                                      color: Color(0xFF3C4450),
                                      fontSize: 14.0)),
                            )),
                      ),
                      new Align(
                        alignment: FractionalOffset(0.9, 0.5),
                        child: Text(
                          '打开通讯录',
                          style: new TextStyle(
                            color: Color(0xFFB4BEC6),
                            fontSize: 14.0,
                          ),
                        ),
                      ),
                      new Align(
                        alignment: FractionalOffset.centerRight,
                        child: Icon(
                          Icons.chevron_right,
                          color: Color(0xFFB4BEC6),
                        ),
                      )
                    ],
                  ),
                ),
                Container(
                  height: 1,
                  color: Color(0x5eDBDBDB),
                  margin: EdgeInsets.only(left: 15.0),
                )
              ],
            ),
          ),
          //电话号码
          Container(
            height: 60,
            color: Color(0xFFFFFFFF),
            child: Column(
              children: <Widget>[
                Container(
                  padding: EdgeInsets.only(left: 15.0, right: 15.0),
                  height: 59,
                  child: Stack(
                    children: <Widget>[
                      new Align(
                        alignment: FractionalOffset.centerLeft,
                        child: Container(
                            width: 150,
                            child: TextField(
                              style: TextStyle(
                                  color: Color(0xFF3C4450), fontSize: 14.0),
                              decoration: InputDecoration(
                                  border: InputBorder.none,
                                  hintText: userPhone,
                                  hintStyle: TextStyle(
                                      color: Color(0xFF3C4450),
                                      fontSize: 14.0)),
                            )),
                      ),
                      new Align(
                        alignment: FractionalOffset(0.9, 0.5),
                        child: Text(
                          '+86',
                          style: new TextStyle(
                            color: Color(0xFFB4BEC6),
                            fontSize: 14.0,
                          ),
                        ),
                      ),
                      new Align(
                        alignment: FractionalOffset.centerRight,
                        child: Icon(
                          Icons.chevron_right,
                          color: Color(0xFFB4BEC6),
                        ),
                      )
                    ],
                  ),
                ),
                Container(
                  height: 1,
                  color: Color(0x5eDBDBDB),
                  margin: EdgeInsets.only(left: 15.0),
                )
              ],
            ),
          ),
          //收货地址
          new GestureDetector(
            onTap: () {
              print("4445454");
            },
            child: Container(
              height: 60,
              color: Color(0xFFFFFFFF),
              child: Column(
                children: <Widget>[
                  Container(
                    padding: EdgeInsets.only(left: 15.0, right: 15.0),
                    height: 59,
                    child: Stack(
                      children: <Widget>[
                        new Align(
                          alignment: FractionalOffset.centerLeft,
                          child: Container(
                            width: 250,
                            child: Text(
                              userLocS,
                              style: new TextStyle(
                                color: Color(0xFF3C4450),
                                fontSize: 14.0,
                              ),
                            ),
                          ),
                        ),
                        new Align(
                          alignment: FractionalOffset.centerRight,
                          child: Icon(
                            Icons.chevron_right,
                            color: Color(0xFFB4BEC6),
                          ),
                        )
                      ],
                    ),
                  ),
                  Container(
                    height: 1,
                    color: Color(0x5eDBDBDB),
                    margin: EdgeInsets.only(left: 15.0),
                  )
                ],
              ),
            ),
          ),
          //收货地址详细
          Container(
            height: 100,
            color: Color(0xFFFFFFFF),
            child: Container(
              padding: EdgeInsets.only(left: 15.0, right: 15.0),
              margin: EdgeInsets.only(top: 10),
              height: 60,
              child: new TextField(
                style: TextStyle(color: Color(0xFF3C4450), fontSize: 14.0),
                maxLength: 40,
                onChanged: (val) {
                  var numberLen = val.toString().length;
                  if (numberLen > 11) {
                    print("4545");
                  }
                },
                maxLines: 2,
                decoration: InputDecoration(
                    border: InputBorder.none,
                    hintText: userLoc,
                    hintStyle:
                        TextStyle(color: Color(0xFF3C4450), fontSize: 14.0)),
              ),
            ),
          ),
          Container(
              height: 60,
              margin: EdgeInsets.only(top: 15.0),
              color: Color(0xFFFFFFFF),
              padding: EdgeInsets.only(left: 15.0, right: 15.0),
              child: Stack(
                children: <Widget>[
                  new Align(
                    alignment: FractionalOffset.centerLeft,
                    child: Text(
                      '设为默认收货地址',
                      style: new TextStyle(
                        color: Color(0xFF3C4450),
                        fontSize: 14.0,
                      ),
                    ),
                  ),
                  new Align(
                    alignment: FractionalOffset.centerRight,
                    child: Switch(
                      value: swachSt,
                      onChanged: (newValue) {
                        setState(() {
                          swachSt = newValue;
                        });
                      },
                    ),
                  )
                ],
              ))
        ],
      )),
    );
  }
}
